package org.etcsoft.examples.jpa.domain;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 * Entity implementation class for Entity: Emplyoee
 *
 */
@Entity
public class Employee implements Serializable {
    private static final long serialVersionUID = 1L;

    private Long id;
    private String name;

    @OneToOne(cascade={CascadeType.PERSIST, CascadeType.REMOVE})
    @JoinColumn(name="id")
    private ParkingSpace parkingSpace;

    @OneToMany(mappedBy="employee", cascade={CascadeType.PERSIST, CascadeType.REMOVE})
    private Collection<Phone> phones;

    @Embedded
    private Address address;

    public Employee() {
        super();
    }

    @Id
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Address getAddress() {
        return this.address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

}
